package com.dragon.mmochat.model.object;


import com.dragon.mmochat.model.enumType.MmochatObjectType;
import com.dragon.mmochat.model.enumType.MmochatPropType;

//道具:不可叠加
//此类clone未深度clone
public class MmochatProp extends MmochatCommonObject implements Cloneable,
		Comparable<MmochatProp> {
	private static final long serialVersionUID = 2142092343349776596L;

	public MmochatProp() {
		super();
		objectType = MmochatObjectType.道具;
	}

	public MmochatProp(MmochatPropType type) {
		super();
		objectType = MmochatObjectType.道具;
		this.propType = type;
		this.curPropAmount = type.getAmount();
		this.canOverlap = type.isCanOverLap();
	}

	public MmochatProp getClone() {
		try {
			return (MmochatProp) super.clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return null;
	}

	public MmochatPropType getType() {
		return propType;
	}

	public void setType(MmochatPropType type) {
		this.propType = type;
	}

	public int getCurAmount() {
		return curPropAmount;
	}

	public void setCurAmount(int curAmount) {
		this.curPropAmount = curAmount;
	}

	public void delAmount(int amount) {
		curPropAmount -= amount;
	}

	@Override
	public int compareTo(MmochatProp other) {
		return propType.getEffectKey() - other.getType().getEffectKey();
	}

	public boolean isCanDeal() {
		return canDeal;
	}

	public void setCanDeal(boolean canDeal) {
		this.canDeal = canDeal;
	}

}
